<template>
    <section class="newsMain">
      <div class="topTitle blue getTop">
        <span class="goBack" @click="goBack"><i></i></span>
        我关注的人
      </div>
      <div class="listA" v-if="dataList!=''">
        <ul>
          <li @click="goRouter(item.id)" v-for="item in dataList">
            <img v-if="item.follow_user.avatar!=''" :src="item.follow_user.avatar">
            <img v-else :src="$store.state.defLogo">
            <p v-if="item.follow_user.nickname!=''" class="name">{{item.follow_user.nickname}}</p>
            <p v-else class="name">{{item.follow_user.id}}</p>
            <p class="meili">魅力值：{{item.follow_user.charm}}</p>
            <p class="span">{{item.follow_user.birthday|ageFilt}}岁·{{item.follow_user.height}}cm</p>
          </li>
        </ul>
      </div>
      <div class="listNone" v-else>
        没有数据
      </div>
    </section>
</template>
<style>
  .mint-loadmore-content ul li{height: 1rem;line-height: 1rem}
  .mint-tabbar{position: relative;}
  .mint-actionsheet{z-index: 10}
</style>
<script>
import axios from 'axios'
import {Post,Get} from '@/config/api.js'

export default {
  name: 'hello',
  data() {
    return {
      name: '',
      password: '',
      dataList:''
    }
  },
  watch:{
    selected:function(){
      this.active=this.selected
    }
  },
  methods:{
    async getData(){
      await Get('/user/follow/'+this.$store.state.uid+'?_include=user,follow_user',this.$store.state.token).then((res)=>{
        console.log(res)
        this.dataList=res.data
      })
    },
    //返回上一页
    goBack(){
      this.$router.go(-1)
    },
    //去个人首页
    async goRouter(id){
      this.$router.push({ path: '/aboutShow',query: { uid: id }})
      let data={
        "visitor_user_id":id
      }
      await Post('/user/visitor',this.$store.state.token,data).then((res)=>{
        console.log(res)
      })
    }
  },
  created: function () {
  },
  mounted: function () {
    this.getData()
  },
  activated: function () {
    console.log(3)
  },
  deactivated: function () {
    console.log(4)
  }
}

</script>
